'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  up: (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM, TEXT } = Sequelize;
    return queryInterface.createTable("config", {
      id: {
        type: INTEGER(20),
        primaryKey: true,
        autoIncrement: true,
      },
      cname: {
        type: STRING(30),
        allowNull: false,
        defaultValue: '',
        comment: "项目名称",
      },
      ename: {
        type: STRING(30),
        allowNull: false,
        defaultValue: '',
        comment: "英文名称",
      },
      value: {
        type: STRING(30),
        allowNull: false,
        defaultValue: "",
        comment: "默认值",
      },
      values: {
        type: STRING(30),
        allowNull: false,
        defaultValue: "",
        comment: "可选值",
      },
      confType: {
        type: INTEGER(20),
        allowNull: false,
        defaultValue: 0,
        comment: "项目类型",
      },
      confCate: {
        type: INTEGER(20),
        allowNull: false,
        defaultValue: 0,
        comment: "项目分类",
      },
      order: {
        type: INTEGER(60),
        allowNull: true,
        defaultValue: 0,
        comment: "排序",
      },
      status: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 1,
        comment: "状态 0禁用 1启用",
      }, 
      created_time: DATE,
      updated_time: DATE,
    });
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable("config");
  },
};
